
#ifndef RPI_CAMERA_CONTROL_H
#define RPI_CAMERA_CONTROL_H

#include "interface/mmal/mmal.h"

int raspicamcontrol_set_saturation(MMAL_COMPONENT_T *camera, int saturation);

int raspicamcontrol_set_sharpness(MMAL_COMPONENT_T *camera, int sharpness);

int raspicamcontrol_set_contrast(MMAL_COMPONENT_T *camera, int contrast);

int raspicamcontrol_set_brightness(MMAL_COMPONENT_T *camera, int brightness);

int raspicamcontrol_set_ISO(MMAL_COMPONENT_T *camera, int ISO);

int raspicamcontrol_set_metering_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_EXPOSUREMETERINGMODE_T m_mode );

int raspicamcontrol_set_video_stabilisation(MMAL_COMPONENT_T *camera, int vstabilisation);

int raspicamcontrol_set_exposure_compensation(MMAL_COMPONENT_T *camera, int exp_comp);

int raspicamcontrol_set_exposure_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_EXPOSUREMODE_T mode);

int raspicamcontrol_set_flicker_avoid_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_FLICKERAVOID_T mode);

int raspicamcontrol_set_awb_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_AWBMODE_T awb_mode);

int raspicamcontrol_set_awb_gains(MMAL_COMPONENT_T *camera, float r_gain, float b_gain);

int raspicamcontrol_set_imageFX(MMAL_COMPONENT_T *camera, MMAL_PARAM_IMAGEFX_T imageFX);

// There isn't actually a MMAL structure for the following, so make one
typedef struct mmal_param_colourfx_s
{
   int enable;       /// Turn colourFX on or off
   int u,v;          /// U and V to use
} MMAL_PARAM_COLOURFX_T;
int raspicamcontrol_set_colourFX(MMAL_COMPONENT_T *camera, const MMAL_PARAM_COLOURFX_T *colourFX);

int raspicamcontrol_set_rotation(MMAL_COMPONENT_T *camera, int rotation);

int raspicamcontrol_set_flips(MMAL_COMPONENT_T *camera, int hflip, int vflip);

typedef struct PARAM_FLOAT_RECT
{
    double x;
    double y;
    double w;
    double h;
} PARAM_FLOAT_RECT_T;

int raspicamcontrol_set_ROI(MMAL_COMPONENT_T *camera, PARAM_FLOAT_RECT_T rect);

typedef enum
{
   ZOOM_IN, ZOOM_OUT, ZOOM_RESET
} ZOOM_COMMAND_T;
int raspicamcontrol_zoom_in_zoom_out(MMAL_COMPONENT_T *camera, ZOOM_COMMAND_T zoom_command, PARAM_FLOAT_RECT_T *roi);

int raspicamcontrol_set_shutter_speed(MMAL_COMPONENT_T *camera, int speed);

int raspicamcontrol_set_DRC(MMAL_COMPONENT_T *camera, MMAL_PARAMETER_DRC_STRENGTH_T strength);

int raspicamcontrol_set_stats_pass(MMAL_COMPONENT_T *camera, int stats_pass);

int raspicamcontrol_set_focus_window(MMAL_COMPONENT_T *camera, int focus_window);

int raspicamcontrol_set_stereo_mode(MMAL_PORT_T *port, MMAL_PARAMETER_STEREOSCOPIC_MODE_T *stereo_mode);

//int raspicamcontrol_set_gains(MMAL_COMPONENT_T *camera, float analog, float digital);

#endif // RPI_CAMERA_CONTROL_H
